Skip to contentSkip to conversation

Reporting: More cross-reference links, etc.

PATCH In review Ian Jackson 2 participants 11 messages Jul 1, 2015

lore
Share & tools
lore
#0 lore raw

cover Reporting: More cross-reference links, etc.

Another miniature series to improve osstest's output.

#1 lore raw

PATCH 1/6 Move flight_otherjob to Osstest.pm

No functional change.

---
 Osstest.pm             |    8 ++++++++
 Osstest/TestSupport.pm |    9 +--------
 2 files changed, 9 insertions(+), 8 deletions(-)
Osstest.pm +8 -0
index bf90153..6535401 100644
@@ -34,6 +34,7 @@ BEGIN {
                       csreadconfig
                       getmethod
                       postfork
+                      flight_otherjob
                       $dbh_tests db_retry db_retry_retry db_retry_abort
                       db_begin_work db_prepare
                       ensuredir get_filecontents_core_quiet system_checked
@@ -302,6 +303,13 @@ sub csreadconfig () {
 
 #---------- generally useful subroutines ----------
 
+sub flight_otherjob ($$) {
+    my ($thisflight, $otherflightjob) = @_;    
+    return $otherflightjob =~ m/^([^.]+)\.([^.]+)$/ ? ($1,$2) :
+           $otherflightjob =~ m/^\.?([^.]+)$/ ? ($thisflight,$1) :
+           die "$otherflightjob ?";
+}
+
 sub get_filecontents_core_quiet ($) { # ENOENT => undef
     my ($path) = @_;
     if (!open GFC, '<', $path) {
Osstest/TestSupport.pm +1 -8
index 699be7e..b5994a4 100644
@@ -45,7 +45,7 @@ BEGIN {
                       report_once
 
                       store_runvar get_runvar get_runvar_maybe
-                      get_runvar_default need_runvars flight_otherjob
+                      get_runvar_default need_runvars
                       unique_incrementing_runvar next_unique_name
 
                       target_cmd_root target_cmd target_cmd_build
@@ -283,13 +283,6 @@ sub need_runvars {
     die "missing runvars @missing ";
 }
 
-sub flight_otherjob ($$) {
-    my ($thisflight, $otherflightjob) = @_;    
-    return $otherflightjob =~ m/^([^.]+)\.([^.]+)$/ ? ($1,$2) :
-           $otherflightjob =~ m/^\.?([^.]+)$/ ? ($thisflight,$1) :
-           die "$otherflightjob ?";
-}
-
 sub otherflightjob ($) {
     return flight_otherjob($flight,$_[0]);
 }
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/6 sg-report-job-history: No longer use TestSupport

In reply to Ian Jackson

This is for test jobs and not appropriate for a reporting script.

---
 sg-report-job-history |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sg-report-job-history +2 -1
index 31b8d37..95ae409 100755
@@ -24,13 +24,14 @@ use Osstest;
 use IO::Handle;
 use HTML::Entities;
 
-use Osstest::TestSupport;
 use Osstest::Executive;
 
 our (@blessings,@branches);
 our $limit= 100;
 our $htmlout;
 our $maxflight;
+our $flight;
+our $job;
 
 open DEBUG, ">/dev/null";
 
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/6 sg-report-job-history: Show osstest version too

In reply to Ian Jackson
---
 sg-report-job-history |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
sg-report-job-history +18 -0
index 95ae409..031bd4a 100755
@@ -199,6 +199,12 @@ END
         push @test_rows, $ri;
     }
 
+    my $osstestverq= db_prepare(<<END);
+        SELECT DISTINCT harness
+          FROM flights_harness_touched
+         WHERE flight=?
+END
+
     if (defined $htmlout) {
         my ($title,$html_file,$url);
 	ensuredir "$htmlout/history";
@@ -219,6 +225,7 @@ END
         print H "<tr><th>started</th><th>flight</th>",
 	        "<th>branch</th><th>failure</th>\n";
         print H "<th>", (join ", ", @hostvarcols), "</th>\n";
+        print H "<th>osstest</th>";
         foreach my $c (@rev_grid_cols) {
             print H "<th>".encode_entities($c)."</th>\n";
         }
@@ -243,6 +250,17 @@ END
             my $lastrev;
             my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} };
             print H "<td>".encode_entities($hosts)."</td>\n";
+            $osstestverq->execute($r->{Flight}{flight});
+            print H
+                "<td>",
+                (join ' ',
+                 map {
+                    $_ = $_->{harness};
+                    s/^([0-9a-f]{12})[0-9a-f]+\b/$1/;
+                    "<kbd>".encode_entities($_)."</kbd>";
+                 }
+                 @{ $osstestverq->fetchall_arrayref({}) }),
+                "</td>\n";
             foreach my $i (0..$#rev_grid_cols) {
                 my $v= $r->{Revisions}[$i];
                 my $same=
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/6 sg-report-flight: Convenience aliases for runvar row

In reply to Ian Jackson

No functional change.

---
 sg-report-flight |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
sg-report-flight +8 -5
index 1f69c08..bd7d968 100755
@@ -942,15 +942,18 @@ END
 <table rules=all><tr><th>Name</th><th>Value</th><th>Source</th></tr>
 END
     my $varsq= db_prepare(<<END);
-        SELECT * FROM runvars
+        SELECT name, val, synth FROM runvars
                 WHERE flight=? AND job=?
              ORDER BY synth, name
 END
     $varsq->execute($fi->{Flight}, $job);
-    while (my $varrow= $varsq->fetchrow_hashref()) {
-        print H "<tr><th>".encode_entities($varrow->{name})."</th>";
-        print H "<td>".encode_entities($varrow->{val})."</td>";
-        print H "<td>".($varrow->{synth} ? 'execution' : 'definition')."</td>";
+    while (my $varrow= $varsq->fetchrow_arrayref()) {
+        my ($vn,$vv,$synth) = (@$varrow);
+        print H "<tr><th>".encode_entities($vn)."</th>";
+        print H "<td>";
+        print H encode_entities($vv);
+        print H "</td>";
+        print H "<td>".($synth ? 'execution' : 'definition')."</td>";
         print H "\n";
     }
     print H "</table></body></html>\n";
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 5/6 sg-report-flight: Link from runvars to to host histories

In reply to Ian Jackson
---
 sg-report-flight |    6 ++++++
 1 file changed, 6 insertions(+)
sg-report-flight +6 -0
index bd7d968..d07ce15 100755
@@ -951,7 +951,13 @@ END
         my ($vn,$vv,$synth) = (@$varrow);
         print H "<tr><th>".encode_entities($vn)."</th>";
         print H "<td>";
+        my $url;
+        if ($vn =~ m/^(?:\w+_)?host$/ && $vv !~ m/[^-.0-9a-z]/) {
+            $url = "$c{ResultsHtmlPubBaseUrl}/host/$vv.html";
+        }
+        print H "<a href=\"",encode_entities($url),"\">" if $url;
         print H encode_entities($vv);
+        print H "</a>" if $url;
         print H "</td>";
         print H "<td>".($synth ? 'execution' : 'definition')."</td>";
         print H "\n";
Signature · 1 line
1.7.10.4
#6 lore raw

Re: [OSSTEST PATCH 5/6] sg-report-flight: Link from runvars to to host histories

On Wed, 2015-07-01 at 12:59 +0100, Ian Jackson wrote:

"to to" in subject.

#7 lore raw

Re: [OSSTEST PATCH 5/6] sg-report-flight: Link from runvars to to host histories

Ian Campbell writes ("Re: [OSSTEST PATCH 5/6] sg-report-flight: Link from runvars to to host histories"):

Quoted 3 lines · Ian Jackson

"to to" in subject.

Fixed, thanks.

Ian.

#8 lore raw

PATCH 6/6 sg-report-flight: Link from runvars to to other jobs

In reply to Ian Jackson
---
 sg-report-flight |   11 +++++++++++
 1 file changed, 11 insertions(+)
sg-report-flight +11 -0
index d07ce15..d8d8492 100755
@@ -954,6 +954,17 @@ END
         my $url;
         if ($vn =~ m/^(?:\w+_)?host$/ && $vv !~ m/[^-.0-9a-z]/) {
             $url = "$c{ResultsHtmlPubBaseUrl}/host/$vv.html";
+        } elsif ($vn =~ m/^(\w*job)$/ && $vv !~ m/[^-+._,=:0-9a-z]/i) {
+            my ($otherflight,$otherjob) =
+                eval { flight_otherjob($fi->{Flight}, $vv); };
+            if (defined $otherjob) {
+                if ($otherflight eq $fi->{Flight}) {
+                    $url = "..";
+                } else {
+                    $url = "$c{ReportHtmlPubBaseUrl}/$otherflight";
+                }
+                $url .= "/$otherjob/info.html";
+            }
         }
         print H "<a href=\"",encode_entities($url),"\">" if $url;
         print H encode_entities($vv);
Signature · 1 line
1.7.10.4
#9 lore raw

Re: [OSSTEST PATCH 6/6] sg-report-flight: Link from runvars to to other jobs

On Wed, 2015-07-01 at 12:59 +0100, Ian Jackson wrote:

"to to" again.

Quoted 27 lines
---
 sg-report-flight |   11 +++++++++++
 1 file changed, 11 insertions(+)
sg-report-flight +11 -0
index d07ce15..d8d8492 100755
@@ -954,6 +954,17 @@ END
         my $url;
         if ($vn =~ m/^(?:\w+_)?host$/ && $vv !~ m/[^-.0-9a-z]/) {
             $url = "$c{ResultsHtmlPubBaseUrl}/host/$vv.html";
+        } elsif ($vn =~ m/^(\w*job)$/ && $vv !~ m/[^-+._,=:0-9a-z]/i) {
+            my ($otherflight,$otherjob) =
+                eval { flight_otherjob($fi->{Flight}, $vv); };
+            if (defined $otherjob) {
+                if ($otherflight eq $fi->{Flight}) {
+                    $url = "..";
+                } else {
+                    $url = "$c{ReportHtmlPubBaseUrl}/$otherflight";
+                }
+                $url .= "/$otherjob/info.html";
+            }
         }
         print H "<a href=\"",encode_entities($url),"\">" if $url;
         print H encode_entities($vv);